Skip to content

hostagent: Log ssh forwarding command #3698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025

Conversation

nirs
Copy link
Member

@nirs nirs commented Jul 6, 2025

We log a message when forwarding to guest unix socket, but it is not clear from the log how this is implemented, and the code is confusing (using ssh forwarding when using GRPC forwarding). Let's make this more clear by logging the ssh forwarding command.

Example logs:

{"level":"debug","msg":"Forwarding unix sockets","time":"2025-07-06T15:59:43+03:00"}

{"level":"info","msg":"Forwarding \"/run/user/501/podman/podman.sock\" (guest) to
    \"/Users/nir/.lima/podman/sock/podman.sock\" (host)","time":"2025-07-06T15:59:43+03:00"}

{"level":"debug","msg":"Running \"/usr/bin/ssh -F /dev/null -o IdentityFile=\\\"/Users/nir/.lima/_config/user\\\"
    -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NoHostAuthenticationForLocalhost=yes
    -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -o IdentitiesOnly=yes
    -o GSSAPIAuthentication=no -o Ciphers=\\\"^[email protected],[email protected]\\\" -o User=nir
    -o ControlMaster=auto -o ControlPath=\\\"/Users/nir/.lima/podman/ssh.sock\\\" -o ControlPersist=yes -T
    -O forward -L /Users/nir/.lima/podman/sock/podman.sock:/run/user/501/podman/podman.sock -N -f -p 53505
    127.0.0.1 --\"","time":"2025-07-06T15:59:43+03:00"}

We log a message when forwarding to guest unix socket, but it is not
clear from the log how this is implemented, and the code is confusing
(using ssh forwarding when using GRPC forwarding). Let's make this more
clear by logging the ssh forwarding command.

Example logs:

    {"level":"debug","msg":"Forwarding unix sockets","time":"2025-07-06T15:59:43+03:00"}

    {"level":"info","msg":"Forwarding \"/run/user/501/podman/podman.sock\" (guest) to
        \"/Users/nir/.lima/podman/sock/podman.sock\" (host)","time":"2025-07-06T15:59:43+03:00"}

    {"level":"debug","msg":"Running \"/usr/bin/ssh -F /dev/null -o IdentityFile=\\\"/Users/nir/.lima/_config/user\\\"
        -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NoHostAuthenticationForLocalhost=yes
        -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -o IdentitiesOnly=yes
        -o GSSAPIAuthentication=no -o Ciphers=\\\"^[email protected],[email protected]\\\" -o User=nir
        -o ControlMaster=auto -o ControlPath=\\\"/Users/nir/.lima/podman/ssh.sock\\\" -o ControlPersist=yes -T
        -O forward -L /Users/nir/.lima/podman/sock/podman.sock:/run/user/501/podman/podman.sock -N -f -p 53505
        127.0.0.1 --\"","time":"2025-07-06T15:59:43+03:00"}

Signed-off-by: Nir Soffer <[email protected]>
@nirs nirs closed this Jul 6, 2025
@nirs nirs reopened this Jul 6, 2025
@AkihiroSuda AkihiroSuda added this to the v1.2.0 milestone Jul 7, 2025
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit cd98edd into lima-vm:master Jul 7, 2025
65 of 66 checks passed
@nirs nirs deleted the hostagenet-forward-logs branch July 7, 2025 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants